package com.example.hetong_system.model;

import javax.persistence.Embeddable;
import java.io.Serializable;
import java.util.Objects;

@Embeddable
public class ContractClauseId implements Serializable {
    private Long contractId;
    private Long clauseId;

    public ContractClauseId() {}

    public ContractClauseId(Long contractId, Long clauseId) {
        this.contractId = contractId;
        this.clauseId = clauseId;
    }

    // getters, setters, equals, hashCode
    public Long getContractId() {
        return contractId;
    }

    public void setContractId(Long contractId) {
        this.contractId = contractId;
    }

    public Long getClauseId() {
        return clauseId;
    }

    public void setClauseId(Long clauseId) {
        this.clauseId = clauseId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ContractClauseId that = (ContractClauseId) o;
        return Objects.equals(contractId, that.contractId) &&
                Objects.equals(clauseId, that.clauseId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(contractId, clauseId);
    }
}